package com.qipay.mapper;

import com.qipay.core.entity.ValueObject;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface SpUserMapper extends com.qipay.baas.mapper.SpUserMapper {
    @Select({
            "select * from sp_user a lEFT JOIN user b on a.name =b.name",
    })
    @Results({
            @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true),
            @Result(column = "sp_user_name", property = "spUserName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "name", property = "name", jdbcType = JdbcType.VARCHAR),
            @Result(column = "level", property = "level", jdbcType = JdbcType.INTEGER),
            @Result(column = "fee_rate", property = "feeRate", jdbcType = JdbcType.REAL),
            @Result(column = "state", property = "state", jdbcType = JdbcType.TINYINT),
    })
    List<ValueObject> myQuery();

    @Update({
            "update `sp_user` set state=#{state,jdbcType=TINYINT} where id= #{id,jdbcType=INTEGER}",
    })
    int updateState(@Param("state")Byte state,@Param("id")Integer id);
}
